package com.zhj.common.web.config;

import com.zhj.common.web.async.AsyncExecutorConfiguration;
import com.zhj.common.web.exception.GlobalException;
import com.zhj.common.web.util.ApplicationContextUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * Web 模块自动配置类
 * @author zhj
 */
@Configuration
@ComponentScan("com.zhj.business")
public class WebAutoConfiguration {

    /**
     * 配置全局异常处理
     * @return
     */
    @Bean
    public GlobalException getGlobalException() {
        return new GlobalException();
    }

    /**
     * Spring容器工具类
     * @return
     */
    @Bean
    public ApplicationContextUtils getApplicationContextUtils() {
        return new ApplicationContextUtils();
    }

    /**
     * 异步线程池-配置属性
     * @return
     */
    @Bean
    public AsyncExecutorConfiguration getAsyncExecutorConfiguration() {
        return new AsyncExecutorConfiguration();
    }
}
